package useful;

import java.util.Objects;

public class Triple<A extends Comparable<A>,B,C> extends Pair<A,B> {
	C c;
	
	public Triple(A a, B b, C c) {
		super(a,b);
		this.c = c;
	}
	
	public C third() {
		return c;
	}
	
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		final Triple<A, B, C> other = (Triple<A, B, C>) obj;
		if (!Objects.equals(this.c, other.c) || !Objects.equals(first(), other.first()) || !Objects.equals(second(), other.second())) {
			return false;
		}
		return true;
	}

	public int hashCode() {
		return first().hashCode();
	}
}
